Skip to content

Refactor: Monorepo#6

Open
dongguacute wants to merge 6 commits intoTransmtfTeam:mainfrom
dongguacute:main
Open

Refactor: Monorepo#6
dongguacute wants to merge 6 commits intoTransmtfTeam:mainfrom
dongguacute:main

Conversation

@dongguacute
Copy link
Copy Markdown
Contributor

Changelog

[Major Refactor] Monorepo Migration and Project Restructuring

🏗 Architecture & Infrastructure

  • Monorepo Transition: Migrated the project from a monolithic structure to a Monorepo using pnpm workspaces and Turbo.
  • Package Separation:
    • Created @hrt-tracker/core: Contains shared logic, PK (Pharmacokinetics) models, calibration, and encryption utilities.
    • Created hrttracker (App): Moved the main React application to apps/hrttracker.
    • Created worker: Moved Cloudflare Workers logic to packages/worker.
  • Build System: Integrated Turbo for optimized build and development pipelines.
  • Dependency Management: Centralized development dependencies in the root package.json and updated pnpm-lock.yaml.

🛠 Refactoring & Code Quality

  • Logic Decoupling: Extracted core business logic (Simulations, EKF, PK models) from the UI layer into the core package.
  • Module Exports: Streamlined module exports and consolidated imports across the application to point to the new core package.
  • Cleanup: Removed obsolete files including legacy calibration, personal model files, and temporary segments.
  • Type Safety: Updated tsconfig structures with a base configuration (tsconfig.base.json) inherited by sub-packages.

🔐 Security & Utilities

  • Encryption Refactor: Reorganized encryption utilities, separating account-security concerns (security-password) from general data export/import encryption.
  • Utility Consolidation: Moved shared helpers like dataHash, authSessionState, and crypto to the core package for better reusability.

🎨 Assets & UI

  • Asset Reorganization: Moved flag SVG icons to a structured directory (apps/hrttracker/src/assets/flags/) and renamed them with ISO country codes for better maintainability.
  • Import Updates: Updated SettingsPage and other components to reflect the new asset paths and consolidated logic imports.

⚙️ Configuration

  • Git: Updated .gitignore to include .pnpm-store, .turbo, and .wrangler.
  • Tauri: Updated tauri.conf.json to point to the new application paths.
  • Wrangler: Updated worker configuration for the new directory structure.

…exports in logic.ts to use core package

- Deleted calibration.ts, personalModel.ts, pk.ts, and types.ts to streamline the codebase.
- Updated logic.ts to re-export all necessary types and functions from the new @hrt-tracker/core package.
- Added .pnpm-store to .gitignore to exclude local package store from version control.
- Updated exports in index.ts to include .js extensions for clarity and added new utility modules.
- Refactored AppDataContext to import computeDataHash from logic instead of utils.
- Simplified authSessionState by re-exporting functions from logic.
- Replaced custom encryption functions in crypto with imports from logic.
- Deleted unused dataHash.ts file to clean up the codebase.
- Updated helpers.tsx to re-export bio dose and raw dose calculation functions from logic.
…nd SettingsPage

- Updated CloudSyncContext to import computeDataHash and isLogoutInProgress from the logic module.
- Streamlined imports in SettingsPage by consolidating utility functions from logic.
…ata.json

- Changed flag imports in SettingsPage from emoji-based filenames to standardized country code filenames.
- Deleted metadata.json as it was no longer needed.
- Deleted index.html, index.tsx, logic.ts, and several other files to streamline the codebase.
- Updated package.json to reflect new project name and dependencies, switching to Turbo for task management.
- Adjusted pnpm workspace configuration to include apps/* for better organization.
- Removed unused assets and configuration files to clean up the project structure.
@xzdmycbx xzdmycbx self-requested a review April 12, 2026 01:50
@xzdmycbx
Copy link
Copy Markdown
Contributor

Thank you for taking the time to work on this refactor. The overall architectural direction makes sense, but given that this project is currently maintained by a very small team, the operational overhead introduced by Turbo and pnpm workspaces is more than we need at this stage.

The core logic files are still fairly small, so there is no real need for physical package separation for now, and we also do not currently have a need to support multiple clients. Because of that, this change feels a bit too heavy for the project’s current state. In my view, the refactor is not especially necessary at the moment and would also increase maintenance complexity.

That said, I still really appreciate the work you put into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants